<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>运营平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="renderer" content="webkit">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/common.css?v=20170207" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/table.css?v=20170117" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/jquery-ui.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ui.min.js" type="text/javascript"></script>
 <script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/yunIndex.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ym-datePlugin-0.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/global.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/cheshan/js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery.placeholder.min.js"></script>
<script type="text/javascript">
 $(function(){
     $("input").placeholder();
     if (navigator.userAgent.indexOf("Safari") > -1) {
       $("input").css("lineHeight","normal !important");
     };
});
</script>

<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/plugin/select2/select2.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type='text/css'>
    #reserve_start_time{height:24px;border:solid 1px #c5c5c5;background:url(http://img1.isou365.cn/paimai/yunying/images/time_pic.jpg) no-repeat 120px 5px; cursor:pointer;}
    #reserve_end_time{height:24px;border:solid 1px #c5c5c5;background:url(http://img1.isou365.cn/paimai/yunying/images/time_pic.jpg) no-repeat 120px 5px;cursor:pointer;}
    .table tbody tr td a:link{color:#20ab4f;text-decoration: underline;}
    .table tbody tr td a:visited{text-decoration: underline;color:#303030;}
    .table tbody tr td a:hover{text-decoration: underline;color:#20ab4f;}
    .table tbody tr td a:active{color:#f99d0c;text-decoration: underline;}
    .table tbody tr td a.not-point{color:#9f9f9f; text-decoration: none;}
    .search6{display: block;clear: left;padding-top: 10px;}
    .search6-input{ margin-left: 0!important;}
</style>
</head>
<body>
<div class="header">
<div class="headerCo">
<span>你好,<?php echo ($user_info["real_name"]); ?><a href="<?php echo (WEB_URL); ?>Emp/logout">退出</a></span>
<h1><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_logo.jpg"></h1>
</div>
</div>
<div class="mian">
<div class="mianL">
    <dl>
        <dd>
            <a id="menu_sy" href="/Index/index" class="shouye">首页</a>
        </dd>
        <?php foreach ($tree_menu as $key => $value): ?>
          <dd>
            <span id="menu_<?php echo ($value['first_char']); ?>" ><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_jia.jpg"><?php echo ($value['name']); ?></span>
            <ul style="display: none;">
                <?php if (!empty($value['children'])): ?>
                    <?php foreach ($value['children'] as $k => $v): ?>
                        <li><a id='menu_<?php echo ($v["first_char"]); ?>' href="<?php echo ($v['url']); ?>"><?php echo ($v['name']); ?></a></li>
                    <?php endforeach ?>
                <?php endif ?>
            </ul>
        <?php endforeach ?>
    </dl>
</div>

<?php $menu = 'yhgz.mcyh'; ?>
<?php $menu=json_encode(explode('.', $menu)); ?>
<script>
    $(function () {
        var cur_menu = '<?php echo ($menu); ?>', cur_menu = eval('[' + cur_menu + ']'), cur_menu = cur_menu[0];
        if (cur_menu == "sy") {
            $("#menu_sy").removeClass('shouye').addClass('current');
        }
        $('#menu_' + cur_menu[0]).click();
        $('#menu_' + cur_menu[0]).find("img").attr("src", "http://img1.isou365.cn/paimai/yunying/images/yun_jie.jpg");
        $(".mianL").css("height", $(document).height() - 95);
        $('#menu_' + cur_menu[1]).addClass('current');
    });
</script>
    <div class="mianR">
      <div class="yuyue">
         <ul>
            <li onclick="change_search(1);get_list(1);" class="yuCurrent">待预约</li>
            <li onclick="change_search(2);get_list(2);">跟踪中</li>
            <li onclick="change_search(3);get_list(8);">预约成功</li>
            <li onclick="change_search(4);get_list(3);">预约失败</li>
         </ul>
      </div>
        <div class="yuList" >
            <div class="yuSuo clearfix">
                <div id="new_owner" class="xinzeng clearfix">
                    <input type="button" onclick="window.location.href='/CarOwner/add';" value="新增用户信息" />
                </div>
                <form id="searchFrom">
                    <div id="search4" style="display: none;">
                        <input type="text" id="trace_start_time" name="trace_start_time" value="<?php echo ($params["trace_start_time"]); ?>" placeholder="下次跟踪开始时间" style="width: 152px;" readonly /><em></em>
                        <input type="text" id="trace_end_time" name="trace_end_time" value="<?php echo ($params["trace_end_time"]); ?>" placeholder="下次跟踪结束时间" readonly  style="margin-right:8px;width: 152px;"/>
                        <select id="trace_type"  name="trace_type" class="tracking_list1" style="height: 26px;">
                            <option value="-1">跟踪类型</option>
                            <?php foreach(C('TRACE_TYPE') as $key=> $item):?>
                            <option value="<?php echo ($key); ?>"><?php echo ($item); ?></option>
                            <?php endforeach;?>
                            <!--<?php if(is_array($trace_type)): $k = 0; $__LIST__ = $trace_type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($k % 2 );++$k;?>-->
                                <!--<option value="<?php echo ($k); ?>"><?php echo ($vo); ?></option>-->
                            <!--<?php endforeach; endif; else: echo "" ;endif; ?>-->
                        </select>
                    </div>
                    <div id="search5" style="display: none;">
                        <input type="text" id="reserve_start_time" name="reserve_start_time" value="<?php echo ($params["reserve_start_time"]); ?>" placeholder="预约开始时间" style="width: 152px;" readonly /><em></em>
                        <input type="text" id="reserve_end_time" name="reserve_end_time" value="<?php echo ($params["reserve_end_time"]); ?>" placeholder="预约结束时间" readonly  style="margin-right:8px;width: 152px;"/>
                    </div>
                    <div id="search1" style="display: none;" >
                        <!--<script src="<?php echo get_style_cdnurl();?>paimai/cheshan/js/model_select.js" type="text/javascript"></script>-->
                        <!--<input type="text" id="car_model" name="car_model" placeholder="请输入车型" />-->
                        <select id="location_area" name="location_area" class="branch_company">
                            <?php if(count($bc_city) > 1): ?><option value="0">请选择所在地</option><?php endif; ?>
                            <?php if(is_array($bc_city)): $i = 0; $__LIST__ = $bc_city;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$city): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>"><?php echo ($city); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                        </select>

                    </div>
                    <div id="search2">
                        <div class="source_input">
                            <input type="text"  name="comefrom" value="" placeholder="请选择渠道来源" readOnly />
                            <div class="source">
                                <ul>
                                    <?php foreach($pfrom as $item):?>
                                    <li date="<?php echo ($item["from_id"]); ?>"><?php echo ($item["from_name"]); ?></li>
                                    <?php endforeach;?>
                                </ul>
                            </div>
                            <div class="sourceCity">
                                <ul>
                                    <?php if(is_array($bc_city)): foreach($bc_city as $k=>$vo): ?><li date-city="<?php echo ($k); ?>"><?php echo ($vo); ?></li><?php endforeach; endif; ?>
                                </ul>
                            </div>
                            <div class="sourceTab">
                                <?php if(is_array($comefrom_list)): foreach($comefrom_list as $k=>$cl): ?><div class="sourceList" date-pid="<?php echo ($k); ?>">
                                        <ul>
                                            <?php if(is_array($cl)): foreach($cl as $key=>$clv): ?><li date-id="<?php echo ($clv["from_id"]); ?>"><?php echo ($clv["from_name"]); ?></li><?php endforeach; endif; ?>
                                        </ul>
                                    </div><?php endforeach; endif; ?>

                                <div class="sourceList siSdian">
                                    <?php if(is_array($city_fours_list)): foreach($city_fours_list as $k=>$cfl): ?><ul style="display: none;" date-code-city="<?php echo ($k); ?>">
                                            <?php if(is_array($cfl)): foreach($cfl as $key=>$cflv): ?><li date-id="<?php echo ($cflv["from_id"]); ?>"><?php echo ($cflv["from_name"]); ?></li><?php endforeach; endif; ?>
                                        </ul><?php endforeach; endif; ?>
                                </div>
                            </div>
                        </div>
                        <!--<select id="from" name="from" class="tracking_list1">-->
                            <!--<option value="0">请选择来源</option>-->
                            <!--<?php foreach($pfrom as $item):?>-->
                            <!--<option value="<?php echo ($item["from_id"]); ?>"><?php echo ($item["from_name"]); ?></option>-->
                            <!--<?php endforeach;?>-->
                        <!--</select>-->
                        <!--<select class="tracking_list1" id="comeFrom" name="comefrom" style="width: 150px;">-->
                            <!--<option value="-2">请选择具体来源</option>-->
                        <!--</select>-->
                    </div>
                    
                    <div id="search6">
                        <input type="text" id="owner_id" name="owner_id" placeholder="车主ID|姓名|车型" value="<?php echo ($params["owner_id"]); ?>" class="suoDian" />
                        <!--<input type="text" id="seller_name" name="seller_name" placeholder="车主姓名" value="<?php echo ($params["seller_name"]); ?>" class="suoDian" />-->
                        <input type="text" id="phone" name="phone" placeholder="车主电话" value="<?php echo ($params["phone"]); ?>" class="suoDian" />
                    </div>
                </form>
                <input type="button" onclick="search('is_search');" id="search" value="搜索" class="suoSou">
            </div>
        </div>
      <div class="listBox" id="listBox">

      </div>
   </div>
    <!--<div id="showOption" style="display:none">-->
        <!--<?php if(is_array($from)): $i = 0; $__LIST__ = $from;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>-->
            <!--<option class="<?php echo ($vo['pid']); ?>" value="<?php echo ($vo['from_id']); ?>" ><?php echo ($vo['from_name']); ?></option>-->
        <!--<?php endforeach; endif; else: echo "" ;endif; ?>-->
    <!--</div>-->
    <div class="clear"></div>
    <div class="yunBei"></div>
<div class="loading"></div>
</body>
</html>
    <script type="text/javascript">
        $("body,html").click(function(event) {
            $(".sourceCity").hide();
            $(".sourceTab .sourceList").hide();
            $(".source").hide();
            event.stopPropagation();
        });

        $(".source_input").click(function(event) {
            event.stopPropagation();
        });
        $(".source_input input").val("");
        $(".source_input input").click(function() {
//            $(this).val("");
            if($(".source").css("display")=="none"){
                $(".source").fadeIn();
            }else{
                $(".source").hide();
            }
            $(".sourceCity").hide();
            $(".sourceTab .sourceList").hide();
        });
        var index;
        var text;
        var dateIndex;
        $(".source ul li").click(function() {
            index=$(".source ul li").index(this);
            text=$(this).html();
            dateIndex=$(this).attr("date");
            if(dateIndex==5){
                $(".sourceCity").fadeIn();
                $(".sourceTab .sourceList").hide();
            }else{
                $(".sourceCity").hide();
                $(".sourceTab .sourceList[date-pid='"+dateIndex+"']").fadeIn().siblings().hide();
            }
            $(this).parent().parent().hide();
        });
        var city;
        var cityIndex;
        $(".sourceCity ul li").click(function(i){
            city=$(this).html();
            $(this).parent().parent().hide();
            cityIndex=$(this).attr("date-city");
            $(".sourceTab .siSdian").fadeIn().find("ul[date-code-city='"+cityIndex+"']").fadeIn().siblings().hide();
        })
        $(".sourceList ul li").click(function(){
            $(this).parent().parent().hide();
            if(index==3){
                $(".source_input input").val(text+" - "+city+" - "+$(this).html());
                $(".source_input input").attr("real-value",$(this).attr("date-id"));
            }else{
                $(".source_input input").val(text+" - "+$(this).html());
                $(".source_input input").attr("real-value",$(this).attr("date-id"));
            }
        });



    $(function(){
        change_search(1);
        $(".cheXiaCo1").hide();
        $(".chexing").css("width","388px");
    });

    get_list(1);

    function get_list(status,params){
        if(status == 1){
            $("#owner_id").attr('placeholder',"车型");
        }else{
            $("#owner_id").attr('placeholder',"车主ID|姓名|车型");
        }
        var url = get_url();
        $.get("/CarOwner/ownerList?status=" + status ,url,function(data){
            $("#listBox").html(data);
        },"html");
        if(params != 'is_search'){
            $("input[name='comefrom']").val("").removeAttr('real-value');
        }
    }

    function get_page(p){
        var url = get_url();
        var status = $("#status").val() ? $("#status").val() : 1 ;
        url += "&status=" + status;
        url += "&p=" + p;
        $.get("/CarOwner/ownerList",url,function(data){
            $("#listBox").html(data);
        },"html");
    }

    function search(params){
        var status = $("#status").val();
        get_list(status,params);
    }

    function get_url(){
        var url = "";
        var brand_id = $('.pingXiaCo').attr('brand_id');
        var series_id = $('.cheXiaCo').attr('series_id');
        //var car_model = $('#car_model').val();
        var comefrom = $("input[name='comefrom']").attr('real-value');
        var from = $('#from').val();
        var location_area = $("#location_area").val();
        var trace_start_time = $("#trace_start_time").val();
        var trace_end_time = $("#trace_end_time").val();
        var reserve_start_time = $("#reserve_start_time").val();
        var reserve_end_time = $("#reserve_end_time").val();
        var owner_id = $("#owner_id").val();
        var trace_type = $("#trace_type").val();
//        var seller_name = $("#seller_name").val();
        var phone = $("#phone").val();

        if (brand_id) {
            url += '&brand_id=' + brand_id;
        }
        if (series_id) {
            url += '&series_id=' + series_id;
        }
//        if(car_model){
//            url += '&car_model=' + encodeURIComponent(car_model);
//        }
        if (comefrom) {
            url += '&comefrom=' + comefrom;
        }
        if (from) {
            url += '&from=' + from;
        }
        if (location_area) {
            url += '&location_area=' + location_area;
        }
        if (trace_start_time) {
            url += '&trace_start_time=' + trace_start_time;
        }
        if (trace_end_time) {
            url += '&trace_end_time=' + trace_end_time;
        }
        if (reserve_start_time) {
            url += '&reserve_start_time=' + reserve_start_time;
        }
        if (reserve_end_time) {
            url += '&reserve_end_time=' + reserve_end_time;
        }
        if (owner_id) {
            url += '&owner_id=' + owner_id;
        }
        if(trace_type){
            url += '&trace_type=' + trace_type;
        }
//        if (seller_name) {
//            url += '&seller_name=' + seller_name;
//        }
        if (phone) {
            url += '&phone=' + phone;
        }
        return url;
    }


    $("#from").change(function(){

        var value = $(this).val(); //获取渠道当前下拉列表选中的值
        //隐藏所有下拉列表的值
        $("#comeFrom option").each(function(){
            if($(this).val()!='-2'){
                $(this).remove();
            }
        });

        //显示具体渠道下拉列表
        $("#showOption option").each(function(){
            if($(this).val() == '' || $(this).attr("class")==value){ //通过判断class名称判断是否显示
                $("#comeFrom").append($(this).clone(true)); //为Select追加一个Option(下拉项)
                if($(this).val()== ''){
                    $(this).prop("selected",true)
                }
            }
        });

    });

    function change_search(st){
        var s1=$("#search1"),s2=$("#search2"),s4=$("#search4"),s5=$("#search5"),s6=$("#search6");
        if(st==1){
            clear_params();
            s1.show();
            s2.show();
            s4.hide();
            s5.hide();
            s6.hide();
            $("#new_owner").show();
        }
        if(st==2){
            clear_params();
            s1.show();
            s2.show();
            s4.show();
            s5.hide();
            s6.show();
            $("#search6").addClass("search6");
            $("#owner_id").addClass("search6-input");
            $("#new_owner").hide();
        }
        if(st==3){
            clear_params();
            s1.show();
            s2.hide();
            s4.hide();
            s5.show();
            s6.show();
            $("#new_owner").hide();
        }
        if(st==4){
            clear_params();
            s1.show();
            s2.show();
            s4.hide();
            s5.hide();
            s6.show();
            $("#new_owner").hide();
        }
    }

    function clear_params(){
        $('.pingXiaCo').attr('brand_id', '');
        $('.cheXiaCo').attr('series_id', '');
        $("#from").val(0);
        $("#comeFrom").val('-2');
        $("#location_area").val();
        $("#trace_start_time").val('');
        $("#trace_end_time").val('');
        $("#owner_id").val('');
//        $("#seller_name").val('');
        $("#phone").val('');
        $("#search6").removeClass("search6");
        $("#owner_id").removeClass("search6-input");
    }

    $("#trace_start_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });

    $("#trace_end_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
    $("#reserve_start_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });

    $("#reserve_end_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
</script>